package com.tian.controller;

import com.tian.SmsResult;
import com.tian.SmsTemplateEnum;
import com.tian.dto.QueryUserReqDto;
import com.tian.feign.UserFeignClient;
import com.tian.sender.SmsSender;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.LinkedHashMap;

/**
 * @author tianwc  公众号：java后端技术全栈、面试专栏
 * @version 1.0.0
 * @date 2023年07月20日 11:49
 * 在线刷题 1200+题和1000+篇干货文章：<a href="http://woaijava.cc/">博客地址</a>
 */
@Slf4j
@RestController
@RequestMapping("/test")
public class TestController {

    @Resource
    private RedissonClient redissonClient;

    @Resource
    private SmsSender aliyunSmsSender;

    @Resource
    private UserFeignClient userFeignClient;

    @GetMapping("/redisson")
    public String redisson() {
        /*RBucket bucket = redissonClient.getBucket("name");
        if(bucket.get()==null){
            bucket.set("公众号：java后端技术全栈");
        }
        LinkedHashMap<String, String> params=new LinkedHashMap<>();
        SmsTemplateEnum smsTemplateEnum= () -> "aliyun env";
        SmsResult smsResult= aliyunSmsSender.send(smsTemplateEnum,params,"18257160352");
        log.info("发送结果："+smsResult);
        return bucket.get().toString();*/
        QueryUserReqDto queryUserReqDto=new QueryUserReqDto();
        queryUserReqDto.setPhone("18257160372");
        userFeignClient.findByPhone(queryUserReqDto);
        return "000";
    }
}
